package com.example.shop.fgo.task.upload.model;

import com.example.shop.fgo.utils.SizeUtil;

/**
 * Created by Administrator on 2017/2/26.
 */

public class SDEntity implements Comparable<SDEntity>{
    private boolean isDir;
//    private boolean isFile;
    private String name;
    private long size;
    private String sizeStr;
    //后缀名，处理checkbox混乱等
    private String ico;
    private boolean isChecked;
    private String absolutePath;
    
    public String getAbsolutePath() {
        return absolutePath;
    }
    
    public void setAbsolutePath(String absolutePath) {
        this.absolutePath = absolutePath;
    }
    
    public boolean isDir() {
        return isDir;
    }
    
    public void setDir(boolean dir) {
        isDir = dir;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public long getSize() {
        return size;
    }
    
    public void setSize(long size) {
        this.size = size;
        this.sizeStr = SizeUtil.formatSize(size);
    }
    
    public String getSizeStr() {
        return sizeStr;
    }
    
    
    public String getIco() {
        return ico;
    }
    
    public void setIco(String ico) {
        this.ico = ico;
    }
    
    public boolean isChecked() {
        return isChecked;
    }
    
    public void setChecked(boolean checked) {
        isChecked = checked;
    }
    
    @Override
    public int compareTo(SDEntity another) {
        //文件夹   和   文件
        if (this.isDir()&&!another.isDir()){
            return -11;
        }else if (!this.isDir()&&another.isDir()){
            return 11;
        } else if (this.isDir()&&another.isDir()){
            return this.getName().compareTo(another.getName());
            
        }else if (!this.isDir()&&!another.isDir()){
            return this.getName().compareTo(another.getName());
        }
        return 0;
    }
}
